package com.zrrd.learn.chapter02;

/**
 * 练习for循环
 *
 * @author wrn
 * @version 1.0
 * @date 2023/4/15 13:18
 */

public class LearnFor01 {

    public static void main(String[] args) {
        //断点  --- 调试bug
        for (int aInt = 1, aMax = 10; aInt < aMax; aInt++) {
            System.out.print((aInt < (aMax >> 1) ? aInt : aMax - aInt) + "\t");
        }

        //计数器 ：
        System.out.println("--->");
        int sum = 0;
        for (int i = 1, amax = 11; i < amax; i++) {
            sum += i;
        }
        System.out.println(sum);

        System.out.println("---> 双指针移动 （循环次数 用时就少）");
        int sum1 = 0;
        for (int i = 1, amax = 11; i < amax; i++, amax--) {
            sum1 += (i + amax);
        }
        System.out.println(sum1);

        //运行符的优先级问题
        for (int i = 1, len = 100; i < len; i++) {
            System.out.print( ((i % 7 == 0 || i % 10 == 7 || i / 10 == 7) ? i + "鼓掌\t" : ""));
        }

    }

}
